#pragma once
#if 0
#include <QOpenGLWidget>
#include <QOpenGLFunctions>
#include <DoubleBuffer.h>
#include <comLib\NetPacket.h>
#include <QOpenGLShaderProgram>
#include "MsgCenter.h"
#include "common\def.h"

QT_FORWARD_DECLARE_CLASS(QOpenGLTexture)
QT_FORWARD_DECLARE_CLASS(QOpenGLShader)
QT_FORWARD_DECLARE_CLASS(QOpenGLShaderProgram)

struct SwsContext;
class DNetServer;

class DImageShower :public QOpenGLWidget, protected QOpenGLFunctions
{
	Q_OBJECT
public:
	explicit DImageShower(QWidget *parent = nullptr);
	~DImageShower();

	void setBackGroundColor(QColor color);
	void show();
	NetPacket* getFreeImageCache();
	void showImage(NetPacket *);
	void setClientSize(const QSize &);

private:
	void initTex2D();
	bool imageProcess(const void *data);
	bool imageSizeProcess(const void *data);

protected:
	void resizeGL(int w, int h) override;
	void paintGL() override;
	void initializeGL() override;


	void mouseMoveEvent(QMouseEvent *event) override;
	void mousePressEvent(QMouseEvent *event) override;
	void mouseReleaseEvent(QMouseEvent *event) override;


signals:
	void UpdateScene();

	private slots:
	void onUpdateScene();

private:
	void init();
	void renderImage();

	GLuint geGlFormat(int nchannel);
	GLint getChannels(int  imgWidth, int widthBytes);

private:
	GLuint m_renderTex;

	GLenum m_GlFormat;
	DWORD startTime, endTime;
	void *m_pPtr;
	bool m_bRelease = false;
	QOpenGLShaderProgram program1;
	QImage imageData;
	QVector<QVector4D> vertices;
	QVector<QVector2D> coord;
	QSize m_ClientSize;
	DNetServer *m_pNetServer;
	MouseCmd mouseInfo;
	HeadInfo m_HeadInfo;

	CDoubleBuffer<NetPacket> *m_pDoubleBuffer;
	DMsgCenter::MsgCallBack m_MsgCallback, m_ImgCallback;
	SwsContext *m_pRgbaSwsContext=nullptr;
	uint8_t *m_pDst_data[4];
	int m_DstLinesize[4];
};
#endif